package view;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JComponent;
import model.Map;
import noname.ConfigSettings;

public class MapView extends JComponent  {
    
    private Map map;
    BufferedImage mapImg;
    
    public MapView(Map map) {
        
        this.map = map;
        
        try {
            String imgPath = ConfigSettings.getInstance().getMapImagePath() + "map1.jpg";
            mapImg = ImageIO.read(new File(imgPath));
        } catch (IOException ex) {
            Logger.getLogger(MapView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    @Override
    public void paint(Graphics g) {
        super.paint(g);
        Graphics2D g2d = (Graphics2D)g;
        g2d.drawImage(mapImg,
                        0,
                        0,
                        mapImg.getWidth(),
                        mapImg.getHeight(),
                        null);
    }
}
